#! /bin/bash
#mxw.sh start/stop
#1、判断参数是否传入
if [ $# -lt 1 ]
then
	echo "必须传入start/stop..."
	exit
fi
#2、根据参数启动、停止
case $1 in
"start")
	pid=$(ps -ef|grep Maxwell|grep -v grep)
	[ "$pid" ] && echo "maxwell已经启动..." || /opt/module/maxwell/bin/maxwell --config /opt/module/maxwell/config.properties --daemon
;;
"stop")
	pid=$(ps -ef|grep Maxwell|grep -v grep)
	[ "$pid" ] && $(ps -ef|grep Maxwell|grep -v grep|awk '{print $2}'|xargs kill -9) || echo "maxwell未启动..."
;;
*)
	echo "参数输入错误..."
;;
esac
